package com.chaos.system.service.client;

import com.chaos.framework.model.dto.result.data.DataResult;
import com.chaos.framework.starter.base.BaseController;
import com.chaos.system.api.dto.AmapAddressDto;
import com.chaos.system.api.dto.AmapGeoDto;
import com.chaos.system.api.feign.AmapFeign;
import com.chaos.system.service.amap.AmapService;
import io.swagger.v3.oas.annotations.Hidden;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Jacky.Cui
 * @since 2024-11-13
 */
@RestController
@RequiredArgsConstructor
@Slf4j
@Hidden
public class AmapClient extends BaseController implements AmapFeign {

    private  final AmapService amapService;
    @Override
    public DataResult<AmapGeoDto> geo(AmapAddressDto address) {
        AmapGeoDto dto=  amapService.geo(address.getCity(), address.getAddr());
        return dataResult(dto);
    }

    @Override
    public DataResult<AmapAddressDto> regeo(AmapGeoDto geo) {
        AmapAddressDto dto = amapService.regeo(geo.getLongitude(), geo.getLatitude());
        return dataResult(dto);
    }
}

